'use strict';
let Response = require('../../model/Response');
let RestifyProxy = require('../../util/RestifyProxy');
let CustomPageBean = require('../../model/CustomPageBean');
let backlogService = require('../../service/HomepageService');
let logger = require('../../util/LoggerUtil').logger('HomepageController.js');

/**
 * 首页页面
 */
module.exports.homepage = function () {
    let response = new Response();
    response.render('back/homepage/homepage');
    this.resolve(response);
};

/**
 * 获取后台统计数据
 * @returns {Promise.<void>}
 */
module.exports.backlogStatistics = async function () {
    let req = this.req;
    let params = req.body;
    let response = new Response();
    try {
        let result = await backlogService.backlogStatistics(this, params);

        response.send(result);
    } catch (error) {
        logger.error(error);
    }
    this.resolve(response);
};
/**
 * 按钮搜索月份
 * @returns {Promise.<void>}
 */
module.exports.selectMonth = async function () {
    let req = this.req;
    let params = req.body;
    let response = new Response();
    try {
        let result = await backlogService.selectMonth(this, params);
        response.send(result);
    } catch (error) {
        logger.error(error);
    }
    this.resolve(response);
};